package com.apps.gomdiem.adapter;


import com.apps.gomdiem.fragment.MenuDetailFragment;
import com.apps.gomdiem.fragment.MenuTabFragment.OnCheckBoxClickedListener;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

public class MenuAdapter extends FragmentPagerAdapter {

	private String[] mListMenu;
	private OnCheckBoxClickedListener onCallBack;
   
	public MenuAdapter(FragmentManager supportFragmentManager, String[] pListMenu, OnCheckBoxClickedListener onCallBack) {
		super(supportFragmentManager);
		this.mListMenu = pListMenu;
		this.onCallBack = onCallBack;
	}

	@Override
	public int getCount() {
		return mListMenu.length;
	}

	@Override
	public Fragment getItem(int position) {
		return MenuDetailFragment.getnewInstance(mListMenu[position], onCallBack);  //Khoahm: truyền callback của mình vào qua lớp này luôn ( cái phần xử lý đó )
	}
	
	@Override
	public CharSequence getPageTitle(int position) {
		return mListMenu[position];
	}

}